import Cookies from 'js-cookie'

const authKey = 'authToken'
const options = {expires: 90}

/**
 * 设置认证token
 * @param {*} value 
 */
export function setToken(value) {
    return Cookies.set(authKey, value, options)
}

/**
 * 获取认证token
 */
export function getToken() {
    return Cookies.get(authKey)
}

/**
 * 判断是否有token
 */
export function hasToken() {
    if (getToken()) {
        return true
    }

    return false
}

/**
 * 清除token
 */
export function removeToken() {
    return Cookies.remove(authKey)
}
